home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / gjr / cmplrtst.lha / unv.scm < prev    next >
Encoding:
Text File  |  1990-03-27  |  352 b   |  26 lines

  1. ;;; -*- Scheme -*-
  2.  
  3. #|
  4. Description:
  5. This code tests variable caches and fluid let.
  6.  
  7. Usage:
  8. (foo 4) -> 4
  9. (bar 4 5) -> 9
  10. (set! foo-var 5)
  11. (foo 4) -> 9
  12. (bar 4 6) -> 10
  13. |#
  14.  
  15. (declare (usual-integrations))
  16.  
  17. (define foo-var)
  18.  
  19. (define (foo x)
  20.   (if (unassigned? foo-var)
  21.       x
  22.       (+ x foo-var)))
  23.  
  24. (define (bar x y)
  25.   (fluid-let ((foo-var y))
  26.     (foo x)))